from typing import Optional, List


class Solution:
    def lengthOfLIS(self, nums: List[int]) -> int:
        len1 = len(nums)
        if len1 <= 1:
            return len1
        result = 0
        dp = [1] * len1
        for i in range(1, len1):
            for j in range(0, i):
                if nums[j] < nums[i]:
                    dp[i] = max(dp[i], dp[j] + 1)
            result = max(result, dp[i])

        return result
